home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 November: Tool Chest / Dev.CD Nov 98 TC.toast / Sample Code / Snippets / Development Tools & Languages / DTSCPlusLibrary / Sources / KeyMapTest.cp < prev    next >
Encoding:
Text File  |  1993-01-14  |  1.3 KB  |  46 lines  |  [TEXT/MPS ]

  1. /* _________________________________________________________________________________________________________ //
  2.   Copyright © 1992 Apple Computer, Inc. All rights reserved.
  3.   Macintosh Developer Technical Support.C++ Macintosh Toolbox Framework.
  4.   Originator: Kent Sandvik
  5.   Date: 9/20/92
  6.   Revision comments are at the end of this file.
  7.   ---
  8.   TKeyMap is a KeyMap utility class.
  9.   TKeyMapTest.cp contains the test functions for the TKeyMap class.
  10.   _________________________________________________________________________________________________________ */
  11.  
  12. #ifndef _KEYMAP_
  13. #include "KeyMap.h"
  14. #endif
  15.  
  16. // This test will scan continously for key strokes, and print them
  17. // out on the screen. Terminate this with command-. (MPW tool or another
  18. // more decent environment).
  19.  
  20. void main(void)
  21. {
  22.     TKeyMap myKeyMap;
  23.  
  24.     // OK, run forever
  25.     for (;;)
  26.     {
  27.         if (myKeyMap.OptionKeyDown())
  28.             cout << "Option Key is down\n";
  29.         if (myKeyMap.CommandKeyDown())
  30.             cout << "Command Key is down\n";
  31.         if (myKeyMap.ShiftKeyDown())
  32.             cout << "Shift Key is down\n";
  33.         if (myKeyMap.IsKeyDown(0x31))            // 0x31 = space bar
  34.             cout << "Space Bar is down\n";
  35.     }
  36. }
  37.  
  38.  
  39. // _________________________________________________________________________________________________________ //
  40.  
  41.  
  42. /*    Change History (most recent last):
  43.   No        Init.    Date        Comment
  44.   1            khs        9/20/92        New file
  45. */
  46.